# -*- coding: utf-8 -*-

from testcases.test_base import TestBase
from utils.log import Logger
import logging
import unittest
from config.constants import *
from openpyxl import load_workbook
import os
from action.page_action import quit_browser


class Test_luoguo_adduser(unittest.TestCase):

    def setUp(self) -> None:
        self.log = Logger(__name__, cmd_level=logging.INFO, file_level=logging.INFO)
        self.test_framework = TestBase(log_name=__name__)
        self.excelPath = os.path.join(projectPath, 'testdata', 'longguo.xlsx')

    def tearDown(self) -> None:
        quit_browser()

    def test_help(self):
        try:
            # 执行测试用例
            passed, total = self.test_framework.execute_test_cases_from_excel(self.excelPath)

            # 可以在这里添加断言，根据通过率判断测试是否通过
            self.assertEqual(passed, total, f"期望{total}条用例全部通过，实际通过{passed}条")

        except Exception as e:
            self.log.logger.error(f"测试执行失败: {str(e)}")
            raise


if __name__ == "__main__":
    unittest.main()